//
//                            5hz display loop
//
void
loop ()
{
  DisplayLoop ();
};

void
DisplayLoop (void)
{
  delayCounter = 100;
  uCurrentAverage = (uCurrentAverage * 7 + (aCurrent + bCurrent)) / 8;
  printSevens (uCurrentAverage * 15 / 23, 1);
  printSevens (uCommandFiltered / 64, 0);
  //printSevens(IS_PWR(motorState),1);
  int bcolor = 64;		//grey for bottom display
  int color = 255;		//white for bottom display
  if (1)
    {
      ISCACHED (lastMotorState != motorState)
      {
	myGLCD.setColor (color, color, color);
	lastMotorState = motorState;
	myGLCD.print (motorStateString[lastMotorState], RIGHT, BOTTOM, bcolor, bcolor, bcolor);
        Serial.println (motorStateString[lastMotorState]);
      }
    }
  ISCACHED (lastRabbit != uRabbit)
  {
    myGLCD.setColor (color, color, color);
    lastRabbit = uRabbit;
    myGLCD.printNumI (lastRabbit, LEFT, BOTTOM, bcolor, bcolor, bcolor);
  }
  if (1)
    {
      ISCACHED (lastBatVoltage != batVoltage)
	ISCACHED (lastBatVoltage != batVoltage + 1)
      {
	myGLCD.setColor (color, color, color);
	lastBatVoltage = batVoltage;
	myGLCD.printNumI (lastBatVoltage, LEFT, TOP, bcolor, 0, bcolor);
      }
    }
  if (0)
    {
      ISCACHED (lastuCurrentLimit != uCurrentLimit)
      {
	myGLCD.setColor (color, color, color);
	lastuCurrentLimit = uCurrentLimit;
	myGLCD.printNumI (lastBatVoltage, RIGHT, TOP, bcolor, 0, bcolor);
      }
    }
  else
    {
      myGLCD.printNumI (delayCounter, RIGHT, TOP, bcolor, 0, bcolor);
    }
  if (delayCounter > 0)
    delay (delayCounter);	//this is the 5hz
}





























